.class public Llt/noframe/gpsfarmguide/notifications/OneSignalController;
.super Ljava/lang/Object;
.source "OneSignalController.java"


# static fields
.field public static final TAG:Ljava/lang/String; = "OneSignalController"


# direct methods
.method public static beginSubscription()V
    .locals 1

    const/4 v0, 0x1

    .line 65
    invoke-static {v0}, Lcom/onesignal/OneSignal;->setSubscription(Z)V

    return-void
.end method

.method public static handleReceivedOneSignalNotification(Landroid/content/Context;Lcom/onesignal/OSNotificationPayload;)V
    .locals 2

    .line 290
    sget-object v0, Llt/noframe/gpsfarmguide/notifications/OneSignalController;->TAG:Ljava/lang/String;

    const-string v1, "Handling the notification received from OneSignal\'s Service..."

    invoke-static {v0, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 293
    iget-object p1, p1, Lcom/onesignal/OSNotificationPayload;->additionalData:Lorg/json/JSONObject;

    .line 297
    :try_start_0
    invoke-static {p0, p1}, Llt/noframe/gpsfarmguide/notifications/OneSignalController;->processOneSignalPayload(Landroid/content/Context;Lorg/json/JSONObject;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1

    :catch_0
    move-exception p0

    .line 299
    invoke-virtual {p0}, Ljava/lang/Exception;->printStackTrace()V

    .line 300
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Failed to process notification received from OneSignal\'s Service: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    if-eqz p1, :cond_0

    .line 301
    invoke-virtual {p1}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object p1

    goto :goto_0

    :cond_0
    const-string p1, "no additional data object"

    :goto_0
    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    .line 300
    invoke-static {p1}, Lcom/crashlytics/android/Crashlytics;->log(Ljava/lang/String;)V

    .line 303
    invoke-static {p0}, Lcom/crashlytics/android/Crashlytics;->logException(Ljava/lang/Throwable;)V

    :goto_1
    return-void
.end method

.method private static processOneSignalPayload(Landroid/content/Context;Lorg/json/JSONObject;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/json/JSONException;
        }
    .end annotation

    .line 322
    new-instance v0, Llt/noframe/gpsfarmguide/notifications/data/models/FarmisNotificationModel;

    invoke-direct {v0, p1}, Llt/noframe/gpsfarmguide/notifications/data/models/FarmisNotificationModel;-><init>(Lorg/json/JSONObject;)V

    .line 324
    invoke-virtual {v0}, Llt/farmis/libraries/notificationcontroller/data/models/BaseNotificationModel;->getType()I

    move-result p1

    const/16 v1, 0x29a

    if-ne p1, v1, :cond_0

    goto :goto_0

    .line 334
    :cond_0
    invoke-static {p0}, Llt/noframe/gpsfarmguide/notifications/FarmisNotificationHelper;->getControllerWithProjectSettings(Landroid/content/Context;)Llt/farmis/libraries/notificationcontroller/NotificationController;

    move-result-object p0

    invoke-virtual {p0, v0}, Llt/farmis/libraries/notificationcontroller/NotificationController;->processNotification(Llt/farmis/libraries/notificationcontroller/data/models/BaseNotificationModel;)V

    :goto_0
    return-void
.end method
